//
//  AdviceFeedBackVC.m
//  XJMCustomer
//
//  Created by Mr.hu on 2017/10/13.
//  Copyright © 2017年 Mr.hu. All rights reserved.
//

#import "MineIntroUpdate.h"

@interface MineIntroUpdate ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *InputAdviceText;
@property (weak, nonatomic) IBOutlet UIButton *IntroSubmitBtn;
@property (nonatomic,copy) AdviceFeedBack adviceblock;

@end

@implementation MineIntroUpdate

-(instancetype)initWithBlock:(AdviceFeedBack)adviceblock
{
    if (self = [super init]) {
        self.adviceblock = adviceblock;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addLeftBtn:[UIImage imageNamed:@"fanhui"] Action:@selector(backToPrevious)];
    self.title = @"简介修改";
    
    self.IntroSubmitBtn.layer.cornerRadius =20;
    self.IntroSubmitBtn.layer.masksToBounds = YES;
    self.InputAdviceText.delegate = self;
    
    UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(jkr_tapGestureAction:)];
    tapGestureRecognizer.cancelsTouchesInView = NO;
    [self.view addGestureRecognizer:tapGestureRecognizer];
    
}

- (void)jkr_tapGestureAction:(UITapGestureRecognizer *)tapGusture{
    
    [self.view endEditing:YES];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.InputAdviceText resignFirstResponder];
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [self.InputAdviceText resignFirstResponder];
    return NO;
}

- (IBAction)AdviceSubmit:(id)sender {
    
    if (self.InputAdviceText.text != nil) {
        self.adviceblock(self.InputAdviceText.text);
    }
    
    [self.navigationController popViewControllerAnimated:YES];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
